package NLP;

import java.util.HashMap;
import java.util.Map;

import sentStruct.Adjective;
import sentStruct.Adverb;
import sentStruct.Noun;
import sentStruct.PartOfSpeech;
import sentStruct.Pronoun;
import sentStruct.Verb;

public class PartOfSpeechAnalyser {
	Map<String, Class<?>> map ;
	
	public PartOfSpeechAnalyser(){
		
	map = new HashMap<String, Class<?>>();	
		
	map.put("JJ", Adjective.class);
	map.put("JJS", Adjective.class);
	map.put("JJR", Adjective.class);
	map.put("NN", Noun.class);
	map.put("NNS", Noun.class);
	map.put("NNP", Noun.class);
	map.put("NNPS", Noun.class);
	map.put("PRP", Pronoun.class);
	map.put("PRP$", Pronoun.class);
	map.put("WP", Pronoun.class);
	map.put("WP$", Pronoun.class);
	map.put("WDT", Pronoun.class);
	map.put("RB", Adverb.class);
	map.put("RBR", Adverb.class);
	map.put("RBS", Adverb.class);
	map.put("WRB", Adverb.class);
	map.put("VB", Verb.class);
	map.put("VBD", Verb.class);
	map.put("VBG", Verb.class);
	map.put("VBN", Verb.class);
	map.put("VBP", Verb.class);
	map.put("VBZ", Verb.class);


	
	}
	
	public Class<?> stringToClass(String str){
		Class<?> cl = map.get(str);
		if (cl==null)
			cl= PartOfSpeech.class;
		return cl;
	}
	public boolean isNoun(String POSstring){
		return Noun.class.equals(map.get(POSstring));
	}
	
	public boolean isVerb(String POSstring){
		return Verb.class.equals(map.get(POSstring));
	}
	
	public boolean isAdverb(String POSstring){
		return Adverb.class.equals(map.get(POSstring));
	}
	public boolean isPronoun(String POSstring){
		return Pronoun.class.equals(map.get(POSstring));
	}
	
	public boolean isAdjective(String POSstring){
		return Adjective.class.equals(map.get(POSstring));
	}

}
